package com.wfuhui.modules.hospital.controller;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wfuhui.modules.hospital.entity.DrugEntity;
import com.wfuhui.modules.hospital.service.DrugService;
import com.wfuhui.common.utils.Query;
import com.wfuhui.common.utils.R;




/**
 * 药品
 * 
 * @author lizhengle
 * @email 2803180149@qq.com
 */
@RestController
@RequestMapping("drug")
public class DrugController {
	@Autowired
	private DrugService drugService;
	
	/**
	 * 列表
	 */
	@RequestMapping("/list")
	public R list(@RequestParam Map<String, Object> params){
		//查询列表数据
        Query query = new Query(params);

		List<DrugEntity> drugList = drugService.queryList(query);
		int total = drugService.queryTotal(query);
		
		return R.ok().put("rows", drugList).put("total", total);
	}
	
	
	/**
	 * 信息
	 */
	@RequestMapping("/info/{id}")
	public R info(@PathVariable("id") Integer id){
		DrugEntity drug = drugService.queryObject(id);
		
		return R.ok().put("drug", drug);
	}

	
}
